<script setup>
import GenericTree from '@/components/tree.vue';
    import {  onMounted,getCurrentInstance,ref} from 'vue'
      // 这里是挂载到proxy实例的上边，可以实现全局调用
    const { proxy } =  getCurrentInstance()
    const treeData = ref([]);// 填充你的树形数据
    const pxoget = async() => {
      const { tree } = await proxy.$api.gettreeData()
      treeData.value = tree 
    }
    const handleCheck = (data, checked, indeterminate) => {
      console.log('Checked node:', data, checked, indeterminate);
    };
    onMounted(()=>{
      pxoget()
    })
    const anniu = () => {
      
    }
    //  封装
    import SearchBar from "./components/SearchBar.vue";
    const searchDate = ref({
        keyword: "",
        placeholder: '请输入你要查询的关键字',
        Options: [
          { label: "视频", value: "video" },
          { label: "文章", value: "article" },
          { label: "用户", value: "user" },
        ],
        selectedValue: "video",
  });
</script>

<template>
  <generic-tree ref="boxw" :tree-data="treeData" @check="handleCheck"></generic-tree>
  <button @click="anniu">按钮</button>
  <div>封装搜索</div>
  <SearchBar v-model="searchDate"></SearchBar>
</template>

<style scoped>

</style>
